﻿<Window x:Class="Finaltec.Hart.Analyzer.View.SettingsDialog"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:meffed="clr-namespace:MEFedMVVM.ViewModelLocator;assembly=MEFedMVVM.WPF" MouseLeftButtonDown="Window_MouseLeftButtonDown"
        meffed:ViewModelLocator.ViewModel="SettingsViewModel"
              Title="SettingsDialog" Style="{StaticResource DialogWindowStyle}" WindowStartupLocation="CenterOwner">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <Grid Grid.Row="0" Grid.ColumnSpan="2" Height="24" Opacity="0.6" Background="{StaticResource DefaultMenuBackground}">
            <TextBlock Margin="5,1,0,1" Text="Hart Communication Settings" TextTrimming="CharacterEllipsis" Background="Transparent" VerticalAlignment="Center" FontWeight="Bold" />
        </Grid>

        <Grid Grid.Row="1" Margin="5">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <Label Grid.Column="0" Grid.Row="0" HorizontalAlignment="Right" Content="COM-Port: " Margin="5,0" VerticalAlignment="Center" />
            <ComboBox Grid.Column="1" Grid.Row="0" ItemsSource="{Binding ComPorts}" SelectedValue="{Binding SettingsDataModel.ComPort, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                      HorizontalAlignment="Left" />


            <Label Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" Content="Number of Preambles: " Margin="5,0" VerticalAlignment="Center" />
            <ComboBox Grid.Column="1" Grid.Row="1" ItemsSource="{Binding PreambleCounts}" SelectedValue="{Binding SettingsDataModel.Preamble, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                      HorizontalAlignment="Left" />

            <CheckBox Content="Show on startup" IsChecked="{Binding SettingsDataModel.ShowSettingsOnStart}" Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="0,5,0,0" />
        </Grid>
        
        <StackPanel Grid.Row="2" HorizontalAlignment="Center" Orientation="Horizontal">
            <Button Content="Confirm" Command="{Binding ConfirmCommand}" IsDefault="True" />
            <Button Content="Cancel" Command="{Binding CancelCommand}" IsCancel="True" />
        </StackPanel>
    </Grid>
</Window>
